﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Form.Master" AutoEventWireup="true" CodeBehind="Form.aspx.cs" Inherits="BBPA.Admin.Store.Orders.Form" %>

<%@ MasterType VirtualPath="~/Form.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script>
        function Event_Amount_change() {
            $('[id$=tb_ExpectAmount]').bind('input propertychange', function () {
          
                if ($(this).val() == "") return;
                $('[id$=btnedit]').click();
            });
            $(".formTable .fa-times").fastClick(function () {
                $(this).parents("tr").remove();
                $('[id$=btnedit]').click();
            })
            $(".formTable [href-info]").fastClick(function () {
                var me = $(this);
                parent.open_popover(me, getAbsoluteUrl(me.attr("href-info")), "" + me.parents("tr").attr("data-row-title"), true);
            })
            $('[id$=tb_Description]').focusout(function () { $('[id$=btnedit]').click(); })
        }
    </script>
    <style>
        .SellWay { position: absolute; margin-top: 30px; }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cph_main" runat="server">
  
    <table class="formTable">
        <tr style="display:none;">
            <td class="td_title">采购日期</td>
            <td>
                <asp:Label ID="lb_SendDate" runat="server" Text=""></asp:Label>
                <p class="help-block">请在本日期之前打款，否则采购日期将顺延到下一周</p>
            </td>
        </tr>
        <tr>
            <td class="td_title">货款金额</td>
            <td style="font-size:16px; color:red;">
                <%=StringPlus.showMoney(ExpectPriceSum) %>
            </td>
        </tr>
        <tr id="tr_ExpressMoney" runat="server">
            <td class="td_title">运费金额</td>
            <td style="font-size:16px; color:red;">
                <%=StringPlus.showMoney(100) %>
            </td>
        </tr>
        <tr id="tr_needMoreMoney" runat="server">
            <td class="td_title" style="font-size:16px; color:red; ">需打款金额</td>
            <td style="font-size:16px; color:red; ">
                <%=StringPlus.showMoney(needMoreMoney) %> 
            </td>
        </tr>
        <tr>
            <td class="td_title"></td>
            <td style=" text-align:right;">
               <asp:Button ID="btnSub" runat="server" Text="确认采购" OnClick="btnSub_Click" CssClass="btn btn-primary"/>
            </td>
        </tr>
    </table>
     <div class="control-group" style=" display:none;">
    <asp:Button ID="btnedit" runat="server" Text="Button" OnClick="btnedit_Click" />
    </div>

    <asp:Repeater ID="rp_Goods" runat="server" OnItemDataBound="rp_Goods_ItemDataBound"  >
        <HeaderTemplate>
            <table class="formTable haveBorder <%=rp_Goods.Items.Count==0?"hide":"" %>">
                <thead>
                    <tr>
                        <th>货品</th>
                        <th>单价</th>
                        <th>数量</th>
                        <th>小计</th>
                        <th>操作</th>
                    </tr>
                </thead>
        </HeaderTemplate>
        <ItemTemplate>
            <tr data-key-id="<%#Eval("GoodsID") %>" data-row-title="<%#Eval("Name") %>">
                <td rowspan="2">
                    <asp:TextBox ID="tb_id" runat="server" CssClass="hide"></asp:TextBox>
                    <a href="###" href-info="/sys/goods/info.aspx?id=<%#Eval("GoodsID") %>&HideOrderForm=1" style="display: block; overflow: hidden; min-width: 200px;">
                        <div style="width: 80px; margin-right: 10px;" class=" inlineblock">
                            <img src="<%#Eval("PicURL") %>" /></div>
                        <div style="min-width: 100px;" class=" inlineblock"><%#Eval("Number") %><br>
                            <div style="line-height: initial;"><%#Eval("BrandName") %> <%#Eval("Name") %></div>
                        </div>
                    </a>
                </td>

                <td style="text-align: center;font-size:16px; color:red;"><%#StringPlus.showCoin(Eval("SellPrice")) %></td>
                <td style="text-align: center;height:60px;">
                    <div class="label label-info SellWay <%#BBPA.BLL.Goods.GetGiftNumberSell( Eval("GoodsID"),Eval("ExpectAmount")) ==0?"hide":"" %>">赠<%# BBPA.BLL.Goods.GetGiftNumberSell( Eval("GoodsID"),Eval("ExpectAmount")) %></div>
                    <asp:TextBox ID="tb_ExpectAmount" runat="server" Style="width: 40px"></asp:TextBox></td>
                <td itemsum="1" class="text-error" style="text-align: center;font-size:16px; color:red;">
                    <div class="label label-info SellWay <%#BBPA.BLL.Goods.GetSellDiscount( Eval("GoodsID"),Eval("ExpectAmount")) ==100?"hide":"" %>"><%#DataTypePlus.requestDecimal( BBPA.BLL.Goods.GetSellDiscount( Eval("GoodsID"),Eval("ExpectAmount")))/10 %>折</div>
                    <%#StringPlus.showCoin( BBPA.BLL.Goods.GetSellPriceSum( Eval("GoodsID"),Eval("ExpectAmount")) ) %>

                </td>
                <td style="text-align: center"><a href="###" class="fa fa-times nowrap">删除</a></td>
            </tr>
            <tr><td colspan="4"><asp:TextBox ID="tb_Description" runat="server"  TextMode="MultiLine" style="width:100%;margin-left:-10px;"></asp:TextBox></td></tr>
        </ItemTemplate>
        <FooterTemplate>
            </table>
                <h3 style="text-align: right; padding-right: 56px;" class="text-error <%=rp_Goods.Items.Count==0?"hide":"" %>">
                    合计：<asp:Label ID="lb_ExpectPriceSum" runat="server" Text=""><%=StringPlus.showMoney(ExpectPriceSum) %></asp:Label></h3>
            <h4 class="text-error <%=rp_Goods.Items.Count==0?"":"hide" %>">还没有选择要采购的商品</h4>
        </FooterTemplate>
    </asp:Repeater>
    
</asp:Content>
